using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace AzureContrib.WindowsAzure.ServiceRuntime
{
	internal class RoleWrapper : IRole
	{
		private readonly Microsoft.WindowsAzure.ServiceRuntime.Role role;

		public RoleWrapper(Microsoft.WindowsAzure.ServiceRuntime.Role role)
		{
			this.role = role;
		}

		public string Name
		{
			get { return role.Name; }
		}

		public ReadOnlyCollection<IRoleInstance> Instances
		{
			get
			{
				return new ReadOnlyCollection<IRoleInstance>(new List<IRoleInstance>(role.Instances.Select(ri => new RoleInstanceWrapper(ri))));
			}
		}
	}
}